<template>
  <div>
<!--    结案前需要展示的东西-->
    <el-card class="box-card">
    <el-form class="form-label" ref="form" :model="form" label-width="150px" >
      <div style="margin-top:2px">
      <div class="shijianyangshi">事件摘要</div>
      <div class="xian"></div>
        <div style="margin-top:20px">
        <el-form-item label="事件描述和事情经过" prop="discussionDepartmentDate"  >
        <div style="color: #4d89dd ; font-size:14px " >
          {{form.situationEdescriptionProcess}}
        </div>
      </el-form-item>
      <div class="line" />


      <el-form-item label="填报人"  prop="discussionSite">
        <div style="color: #4d89dd; font-size: 14px" >
          {{form.reportFiller}}
        </div>
      </el-form-item>
      <div class="line" />
      <el-form-item label="发生时间" prop="discussionPanelist">
        <div style="color: #4d89dd; font-size: 14px"  >
          {{form.occurrenceTime}}
        </div>
      </el-form-item>
      <el-form-item label="事件状态" prop="discussionPanelist">
        <div style="color: #4d89dd; font-size: 14px"  >
          <dict-tag style="color: #4d89dd" :options="dict.type.he_report_event_state" :value="form.reportEventState"/>
        </div>
      </el-form-item>
          <el-form-item label="事件严重程度" prop="discussionPanelist">
            <!--          <div style="color: #4d89dd"  >-->
            <!--            {{form.resultsEventSeverity}}-->
            <!--          </div>-->
            <div class="block" style="font-size: 14px"   >
              <!--            A级:客观环境或条件可能引发不良事件(不良事件隐患)-->
              <el-tag class="el-tag" v-if="form.resultsEventSeverity==='01'" type="success">
                <dict-tag :options="dict.type.he_event_severity" :value="form.resultsEventSeverity"/>
              </el-tag>
              <el-tag class="el-tag" v-if="form.resultsEventSeverity==='02'||form.resultsEventSeverity==='03'||form.resultsEventSeverity==='04'">
                <dict-tag :options="dict.type.he_event_severity" :value="form.resultsEventSeverity"/>
              </el-tag>
              <el-tag style=" background-color:#FFF68F;border-color:#fff1cc;" class="el-tag" v-if="form.resultsEventSeverity==='05'||form.resultsEventSeverity==='06'||form.resultsEventSeverity==='07'||form.resultsEventSeverity==='08'" type="warning">
                <dict-tag style=" color:#CD9B1D;" :options="dict.type.he_event_severity" :value="form.resultsEventSeverity"/>
              </el-tag>
              <el-tag class="el-tag" v-if="form.resultsEventSeverity==='09'" type="danger">
                <dict-tag  :options="dict.type.he_event_severity" :value="form.resultsEventSeverity"/>
              </el-tag>

            </div>
          </el-form-item>

          <el-form-item label="事件分级" prop="discussionPanelist">
            <div class="block" style="font-size: 14px" >
              <!--            IV级事件:错误未发生(错误隐患)(包括损害程度A级)-->
              <el-tag class="el-tag"  v-if="form.resultsEventClassification==='04'" type="success">
                <dict-tag  :options="dict.type.he_event_classification" :value="form.resultsEventClassification"/>
              </el-tag>
              <!--            Ⅲ级事件:发生错误，但未造成患者伤害(包括损害程度B、C、D级)-->
              <el-tag class="el-tag" v-if="form.resultsEventClassification==='03'">
                <dict-tag  :options="dict.type.he_event_classification" :value="form.resultsEventClassification"/>
              </el-tag>
              <!--            Ⅱ级事件:发生错误，且造成患者伤害(包括损害程度E、F、G、H级)-->
              <el-tag style=" background-color:#FFF68F;border-color:#fff1cc;" class="el-tag" v-if="form.resultsEventClassification==='02'" type="warning">
                <dict-tag style=" color:#CD9B1D;" :options="dict.type.he_event_classification" :value="form.resultsEventClassification"/>
              </el-tag>
              <!--            I级事件:发生错误，造成患者死亡(包括损害程度I级)-->
              <el-tag class="el-tag" v-if="form.resultsEventClassification==='01'" type="danger">
                <dict-tag :options="dict.type.he_event_classification" :value="form.resultsEventClassification"/>
              </el-tag>
            </div>
          </el-form-item>
<!--      <el-form-item label="事件严重程度" prop="discussionPanelist">-->
<!--        &lt;!&ndash;          <div style="color: #4d89dd"  >&ndash;&gt;-->
<!--        &lt;!&ndash;            {{form.resultsEventSeverity}}&ndash;&gt;-->
<!--        &lt;!&ndash;          </div>&ndash;&gt;-->
<!--        <div class="block"  >-->
<!--          <dict-tag style="color: #4d89dd" :options="dict.type.he_event_severity" :value="form.resultsEventSeverity"/>-->
<!--        </div>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="事件分级" prop="discussionPanelist">-->
<!--        <div class="block"  >-->
<!--          <dict-tag style="color: #4d89dd" :options="dict.type.he_event_classification" :value="form.resultsEventClassification"/>-->
<!--        </div>-->
<!--      </el-form-item>-->
      <el-form-item label="伤害严重度" prop="discussionPanelist">
        <div class="block"  style="font-size: 14px">
          <dict-tag style="color: #4d89dd" :options="dict.type.he_severity_of_injury" :value="form.resultsSeverityInjury"/>
        </div>
      </el-form-item>


      <div style="margin-top:2px">
      <div class="shijianyangshi">审核事件</div>
      <div class="xian"></div>
      <div style="margin-top:20px">
      <el-form-item  label="审核结果" prop="reviewStatus"  >
        <el-select v-if="reviewStatus!='03'" :disabled="readonly" v-model="form.reviewStatus" placeholder="请选择">
          <el-option
            v-for="dict in dict.type.he_review_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          >
          </el-option>
        </el-select>
        <el-select  v-if="reviewStatus=='03'"  v-model="form.reviewStatus" placeholder="请选择">
          <el-option
            v-for="dict in dict.type.he_review_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <div class="line" />

      <el-form-item  v-if="form.reviewStatus=='01'" label="退回原因"  prop="reviewAdvice">
        <el-input style="width: 40%" type="textarea" :rows="5" v-model="form.reviewAdvice" resize="none"
                  placeholder="请输入内容" ></el-input>
      </el-form-item>
      <el-form-item  v-if="form.reviewStatus=='04'" label="作废原因"  prop="invalidationReason">
        <el-input style="width: 40%" type="textarea" :rows="5" v-model="form.invalidationReason" resize="none"
                  placeholder="请输入内容" ></el-input>
      </el-form-item>
      <el-form-item >
        <el-button  type="primary" v-if="reviewStatus=='03'" @click.prevent.native="shangbao" plain>提交审核</el-button>
      </el-form-item>
      </div>
      </div>
      </div>
      </div>
    </el-form>
    </el-card>
  </div>
</template>

<script>
import {  getReport,updateReport } from "@/api/module/whd/shenhe";

export default {
  name: "Report",
  inject:['reload'],
  dicts: ['he_review_status','he_severity_of_injury','he_department_name','he_event_severity','he_education', 'he_patient_gender', 'he_party_post', 'he_report_event_state', 'he_report_event_type', 'he_patient_age_grades', 'he_event_severity', 'he_review_status', 'he_report_status', 'he_position', 'he_event_classification', 'he_review_event_type', 'he_possibility_of_dispute', 'he_patient_involved', 'he_analyze_reports', 'he_fallback_status', 'he_occurrence_time_period', 'he_event_determinatione', 'he_situation_measures_event', 'he_patient_education_level', 'he_diagnosis_category', 'he_years_of_experience', 'he_severity_of_injury', 'he_reporting_method', 'he_patient_nursing_level', 'he_date_type', 'he_invalidation_status', 'he_patient_ethnic_group', 'he_category', 'he_handling_status'],
  data() {
    return {
      readonly:true,
      //
      reviewStatus:null,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 事件上报信息表格数据
      reportList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    getReport(this.$route.query.id).then(response => {
      this.form = response.data;
      this.reviewStatus=this.form.reviewStatus;
    });
  },
  methods: {
    shangbao() {
      if(this.form.reviewStatus=="03"){
        this.$modal.msgError("请选择审核结果后提交审核！");
        //const obj = { path: "/hosipitalevent/shenhe?type="+this.form.reviewEventType+"&state=03"};
        //this.$tab.closeOpenPage(obj);
        //this.$router.push({path: "/hosipitalevent/shenhe"});
      }
      else{
        updateReport(this.form).then(response => {
          this.$modal.msgSuccess("审核成功");
          const obj = { path: "/hosipitalevent/shenhe?type="+this.form.reviewEventType+"&state=03"};
          this.$tab.closeOpenPage(obj);
          //this.$router.push({path: "/hosipitalevent/shenhe"});
          //this.reload();
        });
      }
      /*this.form.reportStatus = '02'*/

    },
  }
};
</script>

<!--写在最下方的样式-->
<style  lang="scss" scoped>
//@import "src/views/module/shao/blackFont";
.shijianyangshi{
  font-weight: bold;
  font-size: 20px;
  color: #000000;
  text-align: left;
}
.xian{
  border-bottom: 1px solid #ebebeb;
  margin-top: 0.5%;
}

.el-tag{
  font-size: 14px;

}


.form-label{
::v-deep .el-form-item__label{
  font-size: 15px;
  font-weight: bold;
}
}

</style>
